<?php
/*
 * OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures
 * all the essential functionalities required for any enterprise.
 * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
 *
 * OrangeHRM is free software; you can redistribute it and/or modify it under the terms of
 * the GNU General Public License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA
 */
$styleSheet = "orange";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="../../scripts/archive.js"></script>
<script type="text/javascript" src="../../scripts/time.js"></script>

<link href="../../themes/<?php echo $styleSheet;?>/css/leave.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../themes/<?php echo $styleSheet;?>/scripts/style.js"></script>
<link href="../../themes/<?php echo $styleSheet;?>/css/style.css" rel="stylesheet" type="text/css"/>
<!--[if lte IE 6]>
<link href="../../themes/<?php echo $styleSheet; ?>/css/IE6_style.css" rel="stylesheet" type="text/css"/>
<![endif]-->
<!--[if IE]>
<link href="../../themes/<?php echo $styleSheet; ?>/css/IE_style.css" rel="stylesheet" type="text/css"/>
<![endif]-->
<script>
var baseUrl = '?oacode=oamange&action=';

function actionDelete() {
	with (document.frmListOfShifts) {
		check=false;

		for (var i=0; elements.length>i; i++) {
			if ((elements[i].type == 'checkbox') && (elements[i].checked == true)) {
				check = true;
				break;
			}
		}

		if (check) {
			action=baseUrl+'approval';
			submit();
		} else {
			alert("至少选择一条记录以便审批");
		}
	}
}
function doHandleAll() {
	with (document.frmListOfShifts) {
		if(elements['allCheck'].checked == false){
			doUnCheckAll();
		}
		else if(elements['allCheck'].checked == true){
			doCheckAll();
		}
	}
}

function doCheckAll() {
	with (document.frmListOfShifts) {
		for (var i=0; i < elements.length; i++) {
			if (elements[i].type == 'checkbox') {
				elements[i].checked = true;
			}
		}
	}
}

function doUnCheckAll() {
	with (document.frmListOfShifts) {
		for (var i=0; i < elements.length; i++) {
			if (elements[i].type == 'checkbox') {
				elements[i].checked = false;
			}
		}
	}
}

function nextPage() {
	i=document.frmListOfShifts.pageNO.value;
	i++;
	document.frmListOfShifts.pageNO.value=i;
	document.frmListOfShifts.submit();
}

function prevPage() {
	var i=document.frmListOfShifts.pageNO.value;
	i--;
	document.frmListOfShifts.pageNO.value=i;
	document.frmListOfShifts.submit();
}

function chgPage(pNO) {
	document.frmListOfShifts.pageNO.value=pNO;
	document.frmListOfShifts.submit();
}
</script>
</head>
<body class="yui-skin-sam">

<div class="outerbox">
    <div class="outerbox"><div class="top"><div class="left"></div><div class="right"></div><div class="middle"></div></div><div class="maincontent">
        <div class="mainHeading"><h2>自助服务 -- <font color="#ff0000">特殊考勤</font> </h2></div>

    
   <div class="actionbar">
        <div class="actionbuttons">
          
       <input type="button" class="delbutton"  name="btnDel" id="btnDel" alt="Delete" onclick="window.location='./CentralController.php?adcode=report&action=My&s=AddSpecialAttend'" onmouseover="moverButton(this);" onmouseout="moutButton(this);"  value="添加" />
    
                        
        </div>
        <div class="noresultsbar"></div>
        <div class="pagingbar">
		<?php
            $commonFunc = new CommonFunctions();
            $pageStr = $commonFunc->printPageLinks($records['Allcount'], $pageNO);
            $pageStr = preg_replace(array('/#first/', '/#previous/', '/#next/', '/#last/'), array($lang_empview_first, $lang_empview_previous, $lang_empview_next, $lang_empview_last), $pageStr);

            echo $pageStr;
        ?>
        </div>
    <br class="clear">
    </div>
    <br class="clear">
    <form id="frmListOfShifts" name="frmListOfShifts" method="post" action="?oacode=oamange&action=attend&TypeId=<?php echo $records['TypeId'];?>">
    <input type="hidden" name="pageNO" value="1" />

	<table cellspacing="0" cellpadding="0" class="data-table">
        <thead>
            <tr>
                <td scope="col">序号</td>
                <td scope="col">姓名</td>
                <td scope="col">类型</td>
                <td scope="col">事由</td>
                <td scope="col">开始时间</td>
                <td scope="col">结束时间</td>
                <td scope="col">
                    <a href="#" onclick="sortAndSearch(6, 'ASC');"
                    title="按升序排列" class="null">时长(小时)</a>
                </td>
                <td scope="col">组长审批</td>
                <td scope="col">经理审批</td>
                <td scope="col">老板审批</td>
                <td scope="col">操作状态</td>
            </tr>
        </thead>
        <tbody>
            <?php
            $reslut = $records['list'];
            if(is_array($reslut) && count($reslut)>0){
                foreach($reslut as $key => $val){
                    echo '<tr>
					<td scope="col">'.($key+1).'</td>
                    <td scope="col">'.$val['emp_lastname'].$val['emp_firstname'].'</td> 
                    <td scope="col">'.$val['TypeId'].'</td>
					<td scope="col">'.((!empty($val['Content'])) ? $val['Content'] : "无").'</td>
                    <td scope="col">'.@date('Y-m-d H:i:s',$val['StartTime']).'</td>
                    <td scope="col">'.@date('Y-m-d H:i:s',$val['EndTime']).'</td>
                    <td scope="col">'.$val['hour'].'</td>
					<td scope="col">'.(($val['IsCheck']==3) ? "<font color=red>批准</font>" :(($val['IsCheck']==4) ? "<font color=red>批准</font>" : (($val['IsCheck'] ==1) ? "<font color=red>批准</font>" : (($val['IsCheck'] ==2) ? "<font color=red>不审批</font>" : "未审批")))).'</td>
					<td scope="col">'.(($val['IsCheck']==4) ? "<font color=red>批准</font>" :(($val['IsCheck']==1) ? "<font color=red>批准</font>" : (($val['IsCheck'] ==2) ? "<font color=red>不审批</font>" : "未审批"))).'</td>
					<td scope="col">'.(($val['IsCheck'] == 1) ? "<font color=red>批准</font>" : (($val['IsCheck'] ==2) ? "<font color=red>不审批</font>" : "未审批")).'</td>
					<td scope="col">'.(($val['IsCheck'] == 0) ? "<a href=\"?adcode=report&action=My&s=AddSpecialAttend&Id=".$val['Id']."\">编辑</a>" : "不可编辑").'&nbsp;
		'.(($val['IsCheck'] == 0) ? "<a href=\"?adcode=report&action=My&s=deleteSpecialAttend&Id=".$val['Id']."\">删除</a>" : "").'</td>
                    </tr>';
                }
            }else{
                echo "<tr><td  colspan=\"11\" style=\"color:red;text-align:center;padding:10px;\">当前操作没有审批信息</td></tr>";
            }
            ?>
        </tbody>
       </table>
      </form>
  </div><div class="bottom"><div class="left"></div><div class="right"></div><div class="middle"></div></div></div>
</div>



</body>
</html>
